<include file="Public:top" />
<!--头部 end-->
    <script type="text/javascript" src="__PUBLIC__/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/layer/layer.min.js"></script>
 <include file="Public:menu" /> 
 <!--菜单 end-->


    <div class="panel admin-panel">
    	<div class="panel-head"><strong>婚庆公司</strong></div>

        <form action="" method="get" style="float:right;">
              <div style="float:right; margin-right:320px; margin-left:10px;"><input type="submit" class="button button-small border-blue" value="查询" /></div>
                <div style="float:right;">
                    <input type="text" class="input"  name="ly_name" size="20" placeholder="请填写留言者姓名" />
                
                    <input type="hidden" name='seek' value='1'>        
                </div>
             </form>

<form name="myform" id="myform" method="post">
        <div class="padding border-bottom">
            <a class="button button-small checkall" id="checkAll" type="checkbox" href="#"> 全选 </a>
            <a class="button button-small border-green" href="/console/hosturl/update">添加URL </a>
            <a class="button button-small border-yellow" id="delAll" href="#"> 批量删除 </a>
             
        
        <table class="table table-hover">
        	<tr>
        		<th width="45">选择</th>
        		<th width="120">URL地址</th>
                <th width="250">备注</th>
        		<th width="100">留言时间</th>
        		<th width="100">操作</th>
        	</tr>
             <foreach name='results' item='v'>
            <tr>
               	<td>
            		<input type="checkbox" name="check[]" value="{$v.id}" />{$v.id}
            	</td>
            	<td>{$v.img_url}</td>
                <td>{$v.cont}</td>
            	<td>{$v.add_time}</td>
            	<td>
            		<a class="button border-blue button-little" href="/Console/Hosturl/update/id/{$v.id}">查看</a>
                    <a class="button border-yellow button-little del" href="" mark="{$v.id}">删除</a>
            	</td>
            </tr>
            </foreach>

        </table>
        <div class="panel-foot text-center">
            {:$show}
        </div>

    </div>
 </form>
 <include file="Public:box" /> 
 <!--底部 end-->
 <script>
    
    //单选
    $('.del').click(function(){
        var _this = $(this);
        $.layer({
            shade: [0],
            area: ['auto','auto'],
            dialog: {
                msg: '一旦删除后将无法更改，是否确定删除？',
                btns: 2,                    
                type: 5,
                btn: ['确定','取消'],
                yes: function(){
                    
                    $.post('/console/Hosturl/del',{check:_this.attr('mark')},function(data){

                        if ( data.status )
                        {
                            layer.alert(data.info, 1);
                            location.href = '';
                        }
                        else
                        {
                            layer.alert(data.info);
                        }

                    },'json');
       

                }, no: function(){
                   // layer.msg('奇葩', 1, 13);
                }

            }
        });

        return false;    
    })

    //多选
    $('#delAll').click(function(){

        if ( $("[name='check[]']:checked").length <= 0 )
        {
            layer.alert('未选择数据');
            return;
        }

        var _this = $(this);
        $.layer({
            shade: [0],
            area: ['auto','auto'],
            dialog: {
                msg: '一旦删除后将无法更改，是否确定删除？',
                btns: 2,                    
                type: 5,
                btn: ['确定','取消'],
                yes: function(){
                    
                    $.post('/console/Hosturl/del',$('#myform').serialize(),function(data){

                        if ( data.status )
                        {
                            layer.alert(data.info, 1);
                            location.href = '';
                        }
                        else
                        {
                            layer.alert(data.info);
                        }

                    },'json');
       
                }, no: function(){
                   // layer.msg('奇葩', 1, 13);
                }

            }
        });

        return false;    
    })

</script>